﻿@{
    ViewBag.Title = "FineUICore 在线示例 - 基于 jQuery 的专业 ASP.NET Core 控件库";
    var F = Html.F();
}

@section head {

    <link type="text/css" rel="stylesheet" href="~/res/css/index.css?v@(GlobalConfig.ProductVersion)" />
    <link type="text/css" rel="stylesheet" href="~/res/css/mobileview.css?v@(GlobalConfig.ProductVersion)" />
    <link href="~/res/css/login.css" rel="stylesheet" />
}

@functions {
    private void SetCheckedMenuItem(MenuButton menuButton, string checkedValue)
    {
        foreach (MenuItem item in menuButton.Menu.Items)
        {
            MenuCheckBox checkBox = (item as MenuCheckBox);
            if (checkBox != null)
            {
                checkBox.Checked = checkBox.AttributeDataTag == checkedValue;
            }
        }
    }
}

@section body {

    <div id="sideheader" class="f-widget-header f-mainheader">
        <a class="logo" href="@Url.Content("~/")" title="FineUI Core">FineUI Core</a>
    </div>
    <div id="header" class="f-widget-header f-mainheader" style="display:none;">
        <div class="header-left">
            @(F.Button().ID("btnCollapseSidebar").CssClass("icononlyaction").ToolTip("折叠/展开侧边栏").IconAlign(IconAlign.Top).IconFont(IconFont._Fold).EnableDefaultState(false).EnableDefaultCorner(false).TabIndex(-1).Listener("click", "onFoldClick"))
            <div id="breadcrumb">
                <div class="breadcrumb-inner">
                    <span class="breadcrumb-last">首页</span>
                </div>
                <div class="breadcrumb-icons">
                    <a data-qtip="查看源代码" href="javascript:onToolSourceCodeClick();"><i class="f-icon f-iconfont f-iconfont-code"></i></a>
                    <a data-qtip="刷新本页" href="javascript:onToolRefreshClick();"><i class="f-icon f-iconfont f-iconfont-refresh"></i></a>
                    <a data-qtip="在新标签页中打开" href="javascript:onToolNewWindowClick();"><i class="f-icon f-iconfont f-iconfont-new-tab"></i></a>
                </div>
            </div>
        </div>
        <div class="header-right">
            @(F.TwinTriggerBox().ID("ttbxSearch").CssClass("searchbox collapsed").ShowLabel(false).Trigger1Icon(TriggerIcon.Clear).ShowTrigger1(false).EmptyText("搜索示例").Trigger2Icon(TriggerIcon.Search).Width(24).Listener("trigger1click", "onSearchTrigger1Click").Listener("trigger2click", "onSearchTrigger2Click").Listener("blur", "onSearchBlur"))
            @(F.Button().CssClass("icononlyaction btn-apply-trial").ToolTip("基础版下载").IconAlign(IconAlign.Top).IconFont(IconFont._Download).EnableDefaultState(false).EnableDefaultCorner(false).TabIndex(-1).Listener("click", "onBaseDownloadClick").Badge(!ViewBag.CookieIsBase).BadgeType(BadgeType.Warning).BadgeAnimationType(BadgeAnimationType.Processing))
            @(F.Button().CssClass("icononlyaction").ID("btnThemeSelect").ToolTip("主题仓库").IconAlign(IconAlign.Top).IconFont(IconFont._Skin).EnableDefaultState(false).EnableDefaultCorner(false).TabIndex(-1).Listener("click", "onThemeSelectClick"))
            @(F.Button().EnableDefaultCorner(false).EnableDefaultState(false).IconAlign(IconAlign.Left).IconUrl(Url.Content("~/res/images/my_face_80.jpg")).Text("三生石上").CssClass("userpicaction")
                .Menu(F.Menu()
                    .Items(
                        F.MenuCheckBox().Text("仅显示基础版示例").ID("cbxShowOnlyBase").Listener("click", "onShowOnlyBaseClick").Checked(ViewBag.CookieShowOnlyBase),
                        F.MenuButton().Text("企业版试用").IconFont(IconFont._Enterprise).OnClientClick("onApplyTrialClick();"),
                        F.MenuSeparator(),
                        F.MenuButton().Text("显示模式").ID("MenuDisplayMode").Hidden(ViewBag.CookieIsBase || ViewBag.CookieShowOnlyBase)
                            .Menu(F.Menu()
                                .Items(
                                    F.MenuCheckBox().GroupName("DisplayMode").AttributeDataTag("compact").ID("MenuDisplayModeCompact").Text("紧凑模式"),
                                    F.MenuCheckBox().GroupName("DisplayMode").AttributeDataTag("small").ID("MenuDisplayModeSmall").Text("小字体模式"),
                                    F.MenuCheckBox().GroupName("DisplayMode").Checked(true).AttributeDataTag("normal").ID("MenuDisplayModeNormal").Text("普通模式"),
                                    F.MenuCheckBox().GroupName("DisplayMode").AttributeDataTag("large").ID("MenuDisplayModeLarge").Text("大字体模式"),
                                    F.MenuCheckBox().GroupName("DisplayMode").AttributeDataTag("largeSpace").ID("MenuDisplayModeLargeSpace").Text("大间距模式")
                                ).Listener("checkchange", "onMenuDisplayModeCheckChange")
                            ),
                        F.MenuButton().ID("MenuStyle").Text("菜单样式")
                            .Menu(F.Menu()
                                .Items(
                                    F.MenuCheckBox().GroupName("MenuStyle").Checked(true).AttributeDataTag("tree").ID("MenuStyleTree").Text("智能树菜单"),
                                    F.MenuCheckBox().GroupName("MenuStyle").AttributeDataTag("plaintree").ID("MenuStylePlainTree").Text("树菜单")
                                ).Listener("checkchange", "onMenuStyleCheckChange")
                            ),
                        F.MenuButton().ID("MenuMainTabs").Text("主选项卡标签")
                            .Menu(F.Menu()
                                .Items(
                                    F.MenuCheckBox().GroupName("MenuMainTabs").Checked(true).AttributeDataTag("multi").ID("MenuMainTabsMulti").Text("多标签页"),
                                    F.MenuCheckBox().GroupName("MenuMainTabs").AttributeDataTag("single").ID("MenuMainTabsSingle").Text("单标签页")
                                ).Listener("checkchange", "onMenuMainTabsCheckChange")
                            ),
                                F.MenuButton().ID("MenuLang").Text("语言")
                                    .Menu(F.Menu()
                                        .Items(
                                            F.MenuCheckBox().GroupName("MenuLang").Checked(true).AttributeDataTag("zh_CN").ID("MenuLangZHCN").Text("简体中文"),
                                            F.MenuCheckBox().GroupName("MenuLang").AttributeDataTag("zh_TW").ID("MenuLangZHTW").Text("繁體中文"),
                                            F.MenuCheckBox().GroupName("MenuLang").AttributeDataTag("en").ID("MenuLangEN").Text("English"),
                                            F.MenuCheckBox().GroupName("MenuLang").AttributeDataTag("zh_UEY").ID("MenuLangZHUEY").Text("ئۇيغۇر تىلى")
                                        ).Listener("checkchange", "onMenuLangCheckChange")
                                    ),
                                F.MenuButton().ID("btnLoadingSelect").Text("加载动画").Listener("click", "onLoadingSelectClick"),
                                F.MenuSeparator(),
                                F.MenuButton().ID("MenuExamples").Text("在线示例")
                                    .Menu(F.Menu()
                                        .Items(
                                            F.MenuHyperLink().Target("_blank").NavigateUrl("http://pro.fineui.com/").Text("FineUI Pro <div class='online-examples-subtitle'>(ASP.NET WebForms)</div>"),
                                            F.MenuHyperLink().Target("_blank").NavigateUrl("http://mvc.fineui.com/").Text("FineUI MVC <div class='online-examples-subtitle'>(ASP.NET MVC 5)</div></div>"),
                                            F.MenuHyperLink().Target("_blank").NavigateUrl("http://core.fineui.com/").Text("FineUI Core <div class='online-examples-subtitle'>(ASP.NET Core)</div>"),
                                            F.MenuHyperLink().Target("_blank").NavigateUrl("http://pages.fineui.com/").Text("FineUI Core <div class='online-examples-subtitle'>(ASP.NET Core with Razor Pages & Tag Helpers)</div>"),
                                    F.MenuHyperLink().Target("_blank").NavigateUrl("http://js.fineui.com/").Text("FineUI JS <div class='online-examples-subtitle'>(Pure JavaScript Library)</div>")
                                        )
                                    ),
                                F.MenuSeparator(),
                                F.MenuText().HideOnClick(false).CssClass("copyright-menutext")
                                    .Text("<div class=\"copyright\">" +
                                    "<div class=\"version\"><a target=\"_blank\" href=\"http://fineui.com/mvc/\"><img src=\"" + Url.Content("~/res/images/logo/logo_small.png") + "\" alt=\"logo\" /></a>" +
                                    "<br /><span>FineUICore v" + ViewBag.ProductVersion + "</span></div>" +
                                    "<div class=\"actions\"><a target=\"_blank\" href=\"http://wpa.qq.com/msgrd?v=3&uin=2877408506&site=qq&menu=yes\">在线咨询</a>" +
                                    "&nbsp;&nbsp;&nbsp;&nbsp;<a target=\"_blank\" href=\"http://fineui.com/core/version/\">更新记录</a></div>" +
                                    "</div>")
                            )
                        )
            )
        </div>
    </div>

    <div id="applytrial_container" style="display:none;">
        <div>
            请填写如下资料发送到邮箱：2877408506@qq.com
        </div>
        <ul class="applytrial">
            <li>产品名称：FineUICore（企业版）</li>
            <li>单位全称：XXX单位</li>
            <li>申请人邮箱：XXX</li>
            <li>申请人QQ：XXX</li>
            <li>申请人姓名：XXX</li>
            <li>申请人地址：XX省XX市</li>
            <li>申请人电话：XXXXXXX</li>
        </ul>
    </div>

    @(F.Panel().ID("mainPanel").ShowHeader(false).ShowBorder(false).Layout(LayoutType.Region).CssClass("mainpanel").IsViewPort(true)
        .Items(
            F.Panel().ID("sidebarRegion").CssClass("sidebarregion bgpanel").RegionPosition(Position.Left).Width(300).Layout(LayoutType.VBox).ShowBorder(false).ShowHeader(false).RegionSplit(true).RegionSplitIcon(false).RegionSplitWidth(3).RegionSplitTransparent(true)
                .Items(
                    F.Panel().ShowHeader(false).ShowBorder(false).CssClass("topregion").ID("topPanel").ContentEl("#sideheader"),
                    F.Panel().BoxFlex(1).Layout(LayoutType.Fit).ShowHeader(false).ShowBorder(true).CssClass("leftregion").ID("leftPanel")
                        .Items(
                            F.Tree().ID("treeMenu").ShowBorder(false).ShowHeader(false).EnableSingleClickExpand(true).Nodes((TreeNode[])ViewBag.TreeMenuNodes)
                        )
                ).Listener("splitdrag", "onSidebarSplitDrag"),
            F.Panel().ID("bodyRegion").CssClass("bodyregion").RegionPosition(Position.Center).Layout(LayoutType.VBox).ShowBorder(false).ShowHeader(false)
                .Items(
                    F.Panel().ID("topPanel").ShowHeader(false).ShowBorder(false).CssClass("topregion").ContentEl("#header"),
                    F.TabStrip().BoxFlex(1).ShowInkBar(true).InkBarPosition(InkBarPosition.Bottom).EnableTabCloseMenu(true).ShowBorder(true).RegionPosition(Position.Center).CssClass("centerregion").ID("mainTabStrip").ShowTabHeader(@ViewBag.CookieMainTabs=="multi")
                        .Tabs(
                            F.Tab().ID("tabHomepage").IFrameUrl(Url.Content("~/Basic/Main")).EnableIFrame(true).IconFont(IconFont._Home).Title("首页")
                        )
                        .Tools(
                            F.Tool().ID("toolSourceCode").ToolTip("查看源代码").CssClass("tabtool viewcode").IconFont(IconFont._Code).Listener("click", "onToolSourceCodeClick"),
                            F.Tool().ID("toolRefresh").ToolTip("刷新本页").CssClass("tabtool").IconFont(IconFont._Refresh).Listener("click", "onToolRefreshClick"),
                            F.Tool().ID("toolNewWindow").ToolTip("在新标签页中打开").CssClass("tabtool").IconFont(IconFont._NewTab).Listener("click", "onToolNewWindowClick")
                        )
                )
        )
    )
    @(F.Window().Hidden(true).EnableResize(true).EnableMaximize(true).EnableClose(true).Height(600).Width(1000).IsModal(true).EnableIFrame(true).Title("源代码").IconFont(IconFont._Code).ID("windowSourceCode"))
    @(F.Window().Hidden(true).EnableResize(true).EnableMaximize(true).EnableClose(true).Height(600).Width(1000).IsModal(true).ClearIFrameAfterClose(false).IFrameUrl(Url.Content("~/Home/Themes")).EnableIFrame(true).Title("主题仓库").ID("windowThemeRoller"))
    @(F.Window().Hidden(true).EnableResize(true).EnableMaximize(true).EnableClose(true).Height(600).Width(1000).IsModal(true).ClearIFrameAfterClose(false).IFrameUrl(Url.Content("~/Home/Loading")).EnableIFrame(true).Title("加载动画").ID("windowLoadingSelector"))
    @(F.Window().ID("windowApplyTrial").Title("企业版试用").IsModal(true).Width(500).EnableClose(true).EnableMaximize(false).BodyPadding(15).IconFont(IconFont._Mail).Hidden(true).ContentEl("#applytrial_container"))
    @(F.HiddenField().ID("hfExamplesCount").Text(ViewBag.ExamplesCount))
    @(F.Window().Hidden(true).ID("window1").EnableResize(true).EnableMaximize(true).EnableClose(true).Height(450).Width(600).IsModal(true).ShowHeader(false).ShowBorder(true)
       .Layout(LayoutType.VBox)
       .Items(
            F.Panel().ID("img").BoxFlex(1)
            .ShowBorder(false).ShowHeader(false),
            F.SimpleForm().ID("form1").BoxFlex(2)
            .Margin("60px 30px")
            .ShowBorder(false).ShowHeader(false)
            .LabelAlign(LabelAlign.Right).LabelSeparator("&nbsp;&nbsp;&nbsp;")
            .Items(
                F.TextBox().Label("用户名").EmptyText("请输入用户名"),
                F.TextBox().Label("密码").EmptyText("请输入密码"),
                F.Button().ID("btnlogin").Text("登录")
                )
        )
    )
    @(F.Window().Hidden(false).ID("window2").EnableResize(true).EnableMaximize(true).EnableClose(true).Height(325).Width(325).IsModal(true).ShowHeader(false).ShowBorder(true)
       .Layout(LayoutType.VBox)
       .Margin("0 -180 0 0")
       .Items(
            F.SimpleForm().ID("form2").BoxFlex(2)
            .Margin("60px 30px")
            .ShowBorder(false).ShowHeader(false)
            .LabelAlign(LabelAlign.Top).LabelSeparator("&nbsp;&nbsp;&nbsp;")
            .Items(
                F.TextBox().Label("用户名").EmptyText(""),
                F.TextBox().Label("密码").EmptyText(""),
                F.Button().IconFont(IconFont.ChevronRight)
                .IconAlign(IconAlign.Right)
                .ID("btnlogin2").Text("登录")
                )
        )
    )

    @{
        string cookieMenuStyle = (string)ViewBag.CookieMenuStyle;
        string cookieDisplayMode = (string)ViewBag.CookieDisplayMode;
        string cookieMainTabs = (string)ViewBag.CookieMainTabs;
        string cookieLang = (string)ViewBag.CookieLang;
        string cookieSearchText = (string)ViewBag.CookieSearchText;

        // 初始化左侧菜单
        Tree treeMenu = F.GetControl<Tree>("treeMenu");
        if (cookieMenuStyle == "tree")
        {
            treeMenu.HideHScrollbar = true;
            treeMenu.HideVScrollbar = true;
            treeMenu.ExpanderToRight = true;
            treeMenu.HeaderStyle = true;
            treeMenu.AllHeaderStyle = true;
        }

        // 初始化设置 - 显示模式
        SetCheckedMenuItem(F.GetControl<MenuButton>("MenuDisplayMode"), cookieDisplayMode);

        // 初始化设置 - 主选项卡标签
        SetCheckedMenuItem(F.GetControl<MenuButton>("MenuMainTabs"), cookieMainTabs);

        // 初始化设置 - 菜单样式
        SetCheckedMenuItem(F.GetControl<MenuButton>("MenuStyle"), cookieMenuStyle);

        // 初始化设置 - 语言
        SetCheckedMenuItem(F.GetControl<MenuButton>("MenuLang"), cookieLang);

        // 初始化搜索文本
        var ttbxSearch = F.GetControl<TwinTriggerBox>("ttbxSearch");
        if (!String.IsNullOrEmpty(cookieSearchText))
        {
            ttbxSearch.Text = cookieSearchText;
            ttbxSearch.ShowTrigger1 = true;
            ttbxSearch.Width = 200;
            ttbxSearch.CssClass = "searchbox expanded";
        }

        // v8.0 - 对图片背景的主题做特殊处理
        if (F.PageManager.Source.CustomTheme.StartsWith("image_"))
        {
            var bodyRegion = F.GetControl<Panel>("bodyRegion");
            bodyRegion.CssClass += " bgpanel";
        }
    }

}

@section script {

    <script>
        var PARAMS = {
            mainPanel: 'mainPanel',
            mainTabStrip: 'mainTabStrip',
            treeMenu: 'treeMenu',
            sidebarRegion: 'sidebarRegion',
            btnCollapseSidebar: 'btnCollapseSidebar',
            tabHomepage: 'tabHomepage',
            windowSourceCode: 'windowSourceCode',
            windowThemeRoller: 'windowThemeRoller',
            windowLoadingSelector: 'windowLoadingSelector',
            windowApplyTrial: 'windowApplyTrial',
            hfExamplesCount: 'hfExamplesCount',
            sourceUrl: '@Url.Content("~/Home/Source")',
            dashboardUrl: '@Url.Content("~/Block/Dashboard")',
            mainUrl: '@Url.Content("~/Basic/Main")',
            processNewWindowUrl: function (url) {
                return url.replace(/Mobile\/\?file=/ig, '');
            }
        };
    </script>

    <script src="~/res/js/index.js?v@(GlobalConfig.ProductVersion)"></script>
    <script src="~/res/js/mobileview.js?v@(GlobalConfig.ProductVersion)"></script>

}
